import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
//登录页
const login = r => require.ensure([], () => r(require('@/pages/login/index.vue')), 'login');

//主页面
const index = r => require.ensure([], () => r(require('@/components/home.vue')), 'index');
const tu1 = r => require.ensure([], () => r(require('@/pages/veiw/tu1.vue')), 'tu1');
const tu2 = r => require.ensure([], () => r(require('@/pages/veiw/tu2.vue')), 'tu2');
const tu3 = r => require.ensure([], () => r(require('@/pages/veiw/tu3.vue')), 'tu3');
const tu4 = r => require.ensure([], () => r(require('@/pages/veiw/tu4.vue')), 'tu4');
const tu5 = r => require.ensure([], () => r(require('@/pages/veiw/tu5.vue')), 'tu6');
const tu6 = r => require.ensure([], () => r(require('@/pages/veiw/tu6.vue')), 'tu6');
const tu7 = r => require.ensure([], () => r(require('@/pages/veiw/tu7.vue')), 'tu7');
const mysc = r => require.ensure([], () => r(require('@/pages/veiw/mysc.vue')), 'mysc');
const reg = r => require.ensure([], () => r(require('@/pages/reg/index.vue')), 'reg');
const edit = r => require.ensure([], () => r(require('@/pages/home/edit.vue')), 'edit');

// myinvite
const myinvite = r => require.ensure([], () => r(require('@/pages/veiw/myinvite.vue')), 'myinvite');
const fatie = r => require.ensure([], () => r(require('@/pages/veiw/fatie.vue')), 'fatie');
const contents = r => require.ensure([], () => r(require('@/pages/veiw/contents.vue')), 'contents');
const userindex = r => require.ensure([], () => r(require('@/pages/home/userindex.vue')), 'userindex');


export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/',
      component: index,
      children: [
        {
          path: '/tu1',
          name: 'tu1',
          component: tu1,
          meta: {
            keepAlive: false,
            title: '首页'
          }
        }, {
          path: '/tu2',
          name: 'tu2',
          component: tu2,
          meta: {
            keepAlive: false,
            title: '问题'
          }
        }, {
          path: '/tu3',
          name: 'tu3',
          component: tu3,
          meta: {
            keepAlive: false,
            title: '思绪'
          }
        }, {
          path: '/tu4',
          name: 'tu4',
          component: tu4,
          meta: {
            keepAlive: false,
            title: '帖子'
          }
        }, {
          path: '/tu5',
          name: 'tu5',
          component: tu5,
          meta: {
            keepAlive: false,
            title: '分享'
          }
        },
        {
          path: '/tu6',
          name: 'tu6',
          component: tu6,
          meta: {
            keepAlive: false,
            title: '公告'
          }
        }, {
          path: '/tu7',
          name: 'tu7',
          component: tu7,
          meta: {
            keepAlive: false,
            title: '搜索页面'
          }
        }, {
          path: '/userindex',
          name: 'userindex',
          component: userindex,
          meta: {
            keepAlive: false,
            title: '用户主页'
          }
        }, {
          path: '/mysc',
          name: 'mysc',
          component: mysc,
          meta: {
            keepAlive: false,
            title: '收藏'
          }
        },
        {
          path: '/fatie',
          name: 'fatie',
          component: fatie,
          meta: {
            keepAlive: false,
            title: '发帖'
          }
        }, {
          path: '/contents',
          name: 'contents',
          component: contents,
          meta: {
            keepAlive: false,
            title: '帖子正文'
          }
        },
        {
          path: '/myinvite',
          name: 'myinvite',
          component: myinvite,
          meta: {
            keepAlive: false,
            title: '我的帖子'
          }
        },
        {
          path: '/edit',
          component: edit,
          meta: {
            keepAlive: false,
            title: '个人资料'
          }
        }
      ]
    },
    {
      path: '/reg',
      component: reg,
      meta: {
        keepAlive: false,
        title: '注册'
      }
    },
    {
      path: '/login',
      component: login,
      meta: {
        keepAlive: false,
        title: '登录'
      }
    },
  ]
})
